/* -----------------
* brief
* 1. this is code gen by tools
 */

package service

import (
	"saas_sys_base/common"
	. "saas_sys_base/modules/wechat/models"

	"github.com/chanxuehong/wechat/mp/jssdk"
)

type WxSignApiService struct {
	wechatSdkClient WechatSdkClient
}

func (t *WxSignApiService) GetJsSign(appwho common.Who, timestamp, nonceStr, url string) (signature string, err error) {
	jssdkClient, err := t.wechatSdkClient.GetJssdkClientByWho(appwho)
	if err != nil {
		return "", err
	}

	signature, err = jssdk.WXConfigSign2(jssdkClient, nonceStr, timestamp, url)
	return signature, err
}

func (t *WxSignApiService) GetCardSign(appwho common.Who, openid, code, timestamp, cardid, nonce_str string) (signature string, err error) {
	jssdkClient, err := t.wechatSdkClient.GetJssdkClientByWho(appwho)
	if err != nil {
		return "", err
	}
	signature, err = jssdk.CardSign3(jssdkClient, openid, code, timestamp, cardid, nonce_str)
	return signature, err
}
